package cn.luischen.controller.admin;

import cn.luischen.constant.Types;
import cn.luischen.constant.WebConst;
import cn.luischen.controller.BaseController;
import cn.luischen.dto.MetaDto;
import cn.luischen.dto.cond.MetaCond;
import cn.luischen.exception.BusinessException;
import cn.luischen.model.MetaDomain;
import cn.luischen.service.meta.MetaService;
import cn.luischen.utils.APIResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.List;

import static org.junit.Assert.*;
import static org.mockito.ArgumentMatchers.*;
import static org.mockito.Mockito.*;
import org.junit.Rule;
import org.junit.runner.RunWith;
import org.junit.rules.ExpectedException;
import org.junit.Test;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.modules.junit4.PowerMockRunner;
import org.powermock.reflect.Whitebox;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.mockito.stubbing.Answer;
import java.lang.reflect.Method;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.TypeReference;
import com.alibaba.fastjson.parser.ParserConfig;
import java.util.Map;
import java.util.List;
import com.unitspirit.runtime.*;
/**
 * The class contains tests for the class cn.luischen.controller.admin.CategoryController.
*
* @generatedBy UnitSpirit CreateTemplateTestFile4
* @version 1.0.9.11 
*/
@PowerMockIgnore({"javax.management.*"})
public class CategoryController_index_WGTest {
  @Rule  
  public ExpectedException unitspirit_thrown= ExpectedException.none();
  /**
  * 测试方法初始化.
  * 
  * @throws Exception 
  *         if the initialization fails for some reason 
  *  
  * @generatedBy UnitSpirit at 2021-12-08 11:01:14
  */  
 @org.junit.Before 
  public void setUp()  throws Exception 
  { 
    try{
    GlobalUnitInit.init(); 
    MockitoAnnotations.initMocks(this);
   ParserConfig.getGlobalInstance().setAutoTypeSupport(true);
}catch(Exception ex){
  ex.printStackTrace();
}
  }

  
@InjectMocks 
cn.luischen.controller.admin.CategoryController unitspirit_fixture;

@Mock 
cn.luischen.service.meta.MetaService mock_MetaService;

  /**
  * @date 2021-12-08 11:01:15
  * @see cn.luischen.controller.admin.CategoryController#index
  * @category null  
  * @author UnitSpirit   
  */
  @Test
  public void test_index_1001_002842_909_2_02() throws Throwable {
    //被测函数参数定义
    javax.servlet.http.HttpServletRequest HttpServletRequest_p_0 = Mockito.mock(javax.servlet.http.HttpServletRequest.class);
  //成员变量设置


    //返回值定义 
    String result_expected = "\"admin/category\"";


    String Stringrepeat_mock2_0 = "categories";
    Object Objectrepeat_mock2_1 = "[{\"count\":1,\"name\":\"默认分类\",\"mid\":42,\"type\":\"category\",\"slug\":\"默认分类\"},{\"count\":0,\"name\":\"国庆测试2\",\"mid\":43,\"type\":\"category\"}]";
    String Stringrepeat_mock1_0 = "tags";
    Object Objectrepeat_mock1_1 = "[{\"count\":1,\"name\":\"国庆测试1\",\"mid\":41,\"type\":\"tag\",\"slug\":\"国庆测试1\"}]";


    String  unitspirit_result =  unitspirit_fixture.index(HttpServletRequest_p_0);
  //getAssertCase 
    UnitAssert.assertEquals(result_expected,unitspirit_result);
  }
  /**
  * @date 2021-12-08 11:01:15
  * @see cn.luischen.controller.admin.CategoryController#index
  * @category null  
  * @author UnitSpirit   
  */
  @Test
  public void test_index_1001_002842_909_2_01() throws Throwable {
    //被测函数参数定义
    javax.servlet.http.HttpServletRequest HttpServletRequest_p_0 = Mockito.mock(javax.servlet.http.HttpServletRequest.class);
  //成员变量设置


    //返回值定义 
    String result_expected = "\"admin/category\"";

    String Stringrepeat_mock2_0 = "categories";
    Object Objectrepeat_mock2_1 = "[{\"count\":1,\"name\":\"默认分类\",\"mid\":42,\"type\":\"category\",\"slug\":\"默认分类\"},{\"count\":0,\"name\":\"国庆测试2\",\"mid\":43,\"type\":\"category\"}]";
    String Stringrepeat_mock1_0 = "tags";
    Object Objectrepeat_mock1_1 = "[{\"count\":1,\"name\":\"国庆测试1\",\"mid\":41,\"type\":\"tag\",\"slug\":\"国庆测试1\"}]";


    String  unitspirit_result =  unitspirit_fixture.index(HttpServletRequest_p_0);
  //getAssertCase 
    UnitAssert.assertEquals(result_expected,unitspirit_result);
  }
}